CREATE TABLE [dbo].[TDMOVI_TRCA]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[CO_CAJA] [dbo].[TD_VC_008] NOT NULL,
[AA_CAJA] [dbo].[TD_VC_004] NOT NULL,
[MM_CAJA] [dbo].[TD_VC_002] NOT NULL,
[TI_MOVI] [dbo].[TD_VC_001] NOT NULL,
[NU_COMP_CAJA] [dbo].[TD_VC_008] NOT NULL,
[NU_SECU] [dbo].[TD_IN_001] NOT NULL CONSTRAINT [DF__TDMOVI_TR__NU_SE__07420643] DEFAULT ((0)),
[CO_EMPR_DEST] [dbo].[TD_VC_002] NULL,
[CO_CAJA_DEST] [dbo].[TD_VC_008] NULL,
[AA_CAJA_DEST] [dbo].[TD_VC_004] NULL,
[MM_CAJA_DEST] [dbo].[TD_VC_002] NULL,
[TI_MOVI_DEST] [dbo].[TD_VC_001] NOT NULL,
[NU_COMP_DEST] [dbo].[TD_VC_008] NULL,
[CO_TIPO_OPER] [dbo].[TD_VC_003] NULL,
[FE_OPER] [dbo].[TD_DT_001] NULL,
[FA_TIPO_CAMB] [dbo].[TD_NU_015_006] NOT NULL CONSTRAINT [DF__TDMOVI_TR__FA_TI__08362A7C] DEFAULT ((1.000)),
[CO_UNID_CONC] [dbo].[TD_VC_003] NOT NULL,
[IM_MOVI] [dbo].[TD_NU_016_004] NOT NULL CONSTRAINT [DF__TDMOVI_TR__IM_MO__092A4EB5] DEFAULT ((0)),
[IM_CONV] [dbo].[TD_NU_016_004] NOT NULL CONSTRAINT [DF__TDMOVI_TR__IM_CO__0A1E72EE] DEFAULT ((0)),
[DE_OBSE] [dbo].[TD_VC_100] NULL,
[TI_MOVI_CNTA] [dbo].[TD_VC_003] NULL,
[CO_CNTA_EMPR] [dbo].[TD_VC_020] NULL,
[TI_ENTI] [dbo].[TD_VC_001] NULL,
[CO_ENTI] [dbo].[TD_VC_020] NULL,
[TI_DOCU] [dbo].[TD_VC_003] NULL,
[NU_DOCU] [dbo].[TD_VC_020] NULL,
[CO_ORDE_SERV] [dbo].[TD_VC_020] NULL,
[CO_SUBR] [dbo].[TD_VC_003] NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TDMOVI_TR__CO_US__0B129727] DEFAULT (suser_sname()),
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TDMOVI_TR__FE_US__0C06BB60] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TDMOVI_TR__CO_US__0CFADF99] DEFAULT (suser_sname()),
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TDMOVI_TR__FE_US__0DEF03D2] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TDMOVI_TRCA] ADD CONSTRAINT [PK__TDMOVI_T__728CABD3082C08DB] PRIMARY KEY CLUSTERED  ([CO_EMPR], [CO_CAJA], [AA_CAJA], [MM_CAJA], [TI_MOVI], [NU_COMP_CAJA], [NU_SECU]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TDMOVI_TRCA] ADD CONSTRAINT [FK__TDMOVI_TRCA__61F1515A] FOREIGN KEY ([CO_EMPR], [CO_CAJA], [AA_CAJA], [MM_CAJA], [TI_MOVI], [NU_COMP_CAJA]) REFERENCES [dbo].[TCMOVI_CAJA] ([CO_EMPR], [CO_CAJA], [AA_CAJA], [MM_CAJA], [TI_MOVI], [NU_COMP_CAJA])
GO
ALTER TABLE [dbo].[TDMOVI_TRCA] ADD CONSTRAINT [FK__TDMOVI_TRCA__600908E8] FOREIGN KEY ([CO_EMPR], [CO_TIPO_OPER]) REFERENCES [dbo].[TTTIPO_OPER] ([CO_EMPR], [CO_TIPO_OPER])
GO
ALTER TABLE [dbo].[TDMOVI_TRCA] ADD CONSTRAINT [FK__TDMOVI_TRCA__60FD2D21] FOREIGN KEY ([CO_EMPR_DEST], [CO_CAJA_DEST], [AA_CAJA_DEST], [MM_CAJA_DEST]) REFERENCES [dbo].[TMSACA_MENS] ([CO_EMPR], [CO_CAJA], [AA_CAJA], [MM_CAJA])
GO
